package OOday03;

public class RefArrayDemo {
    public static void main(String[] args) {
        /*
        Dog[] dogs=new Dog[3];
        Chick[] chicks=new Chick[3];
        Fish[] fish=new Fish[2];
         */
        Dog[] dogs=new Dog[3];
        dogs[0] = new Dog("仔仔",3,"黄");
        dogs[1] = new Dog("洋洋",2,"黑");
        dogs[2] = new Dog("旺财",5,"白");
        for (int i=0;i<dogs.length;i++){
            System.out.println(dogs[i].name);
            dogs[i].LookHome();
        }

        Chick[] chicks=new Chick[2];
        chicks[0] = new Chick("篮",2,"黑");
        chicks[1] = new Chick("球",1,"白");
        for (int i=0;i<chicks.length;i++){
            System.out.println(chicks[i].age);
            chicks[i].LayEggs();
        }

        Fish[] fish = new Fish[4];
        fish[0] = new Fish("庄周",19,"蓝");
        fish[1] = new Fish("娜美",18,"绿");
        fish[2] = new Fish("小红",2,"红");
        fish[3] = new Fish("小金",1,"金");
        for (int i=0;i< fish.length;i++){
            System.out.println(fish[i].color);
            fish[i].swim();
        }
    }
}